/*
 * $Id: RequestDefn2OnwatchFileInfoDAO.java,v 1.6 2009/07/10 15:18:36 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2008 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.database.dao;

import java.util.List;
import java.util.Vector;

import org.springmodules.cache.annotations.Cacheable;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.database.pojo.CfgOnwatchFileInfo;
import com.ge.healthcare.autosc.common.database.pojo.CfgReqDefnToOnwatchFi;

public class RequestDefn2OnwatchFileInfoDAO extends BaseDAO 
		implements IRequestDefn2OnwatchFileInfoDAO {
	/**
	 * Eclispe generated
	 */
	private static final long serialVersionUID = -8513182062214933209L;
	private static final String TABLE_NAME = "com.ge.healthcare.autosc.common.database.pojo.CfgReqDefnToOnwatchFi";
	private static final String COL_REQUEST_DEFN_ID = "id.requestDefnId";
	
	public RequestDefn2OnwatchFileInfoDAO() {
		super(TABLE_NAME);
	}
	
	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.IOnwatchFileInfoDAO#getOnwatchFileInfoForRequestDefn(java.lang.Long)
	 */
	@Cacheable(modelId = "RequestDefn2OnwatchFiDAOCacheModel")
	public List<CfgOnwatchFileInfo> getOnwatchFileInfoForRequestDefn(
			Long requestDefnId) {
		List<CfgOnwatchFileInfo> onwatchFileInfoLst = new Vector<CfgOnwatchFileInfo>();
		List<?> rtvdOnwatchFileInfoLst = this.findByProperty(COL_REQUEST_DEFN_ID,
				requestDefnId);
		if (!ASCUtil.isNullOrEmptyList(rtvdOnwatchFileInfoLst)) {
			for (int iCount = 0; iCount < rtvdOnwatchFileInfoLst.size(); iCount++) {
				onwatchFileInfoLst
					.add(((CfgReqDefnToOnwatchFi) rtvdOnwatchFileInfoLst
							.get(iCount)).getId().getCfgOnwatchFileInfo());
			}
		}
		return onwatchFileInfoLst;
	}
	
	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#save(java.lang.Object)
	 */
	public void save(Object pojo) {
		super.save(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.IRequestTypeDAO#saveAlways(java.lang.Object)
	 */
	public void saveAlways(Object pojo) {
		super.save(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#deleteByID(java.lang.Object)
	 */
	public void deleteByID(Object pojo) {
		super.deleteByID(pojo);
	}

	/**
	 * @see com.ge.healthcare.autosc.common.database.dao.BaseDAO#refresh(java.lang.Object)
	 */
	public void refresh(Object pojo) {
		super.refresh(pojo);
	}
}
